package Interface;

import Book.BookList;

import java.util.Scanner;

/**
 * @Author YuanYuan
 * @Date 2022/5/18
 * @Time 10:40
 */
public class FindBook implements INterface {
    @Override
    public void work(BookList bookList) {
        System.out.println("查找图书");
        Scanner scanner = new Scanner(System.in);
        System.out.print("请输入要查找的书名: ");
        String name = scanner.nextLine();
        for (int i = 0; i < bookList.getNumber(); i++) {
            if(bookList.getBooks(i).getName().equals(name)) {
                    System.out.println(bookList.getBooks(i).toString());
                    return;
            }
        }
        System.out.println("图书馆没有这本书哦~");
        return;
    }
}
